<template>
	<view class="normal-login-container">
		<div class="mox">
			<div class="tom" v-for="(item,index) in list" :key="index" @click="fun(item)">
				<div class="tom-img">
					<img style="width: 100%;object-fit: contain;" :src="item.activity_cover_path" alt="" />
				</div>
				<div class="tom-som">
					<div>
						<div class="tom-som-h" style="display: flex;justify-content: space-between;">
							<div>{{ item.activity_title }}</div>
							<div style="position: absolute;right: 12px;">
								<div v-if="item.activity_status==0">待审核</div>
								<div style="color:#339966;" v-if="item.activity_status==1">已通过</div>
								<div style="color: red;" v-if="item.activity_status==-1">被拒绝</div>
							</div>
						</div>
						<div>{{ item.activity_describe }}</div>
					</div>
				</div>
				<div class="tom-fixed">
					<div style="font-weight: 600;">{{ item.year }}</div>
					<div style="font-size: 10px;margin-top: -4px;">——</div>
					<div style="font-weight: 600;font-size: 10px;margin-top: -4px;">{{ item.month }}月</div>
				</div>
			</div>
		</div>
	</view>
</template>

<script>
	import {
		user_getUserCreateActivityInfo
	} from '@/api/system/user.js'
	export default {
		data() {
			return {
				currentTabIndex: 0,
				list: [],
				count: ""
			}
		},
		created() {
			this.user_getUserCreateActivityInfo()
		},
		methods: {
			async user_getUserCreateActivityInfo() {
				const data = await user_getUserCreateActivityInfo();
				if (data.code == 200) {
					this.count = data.content.count;
					this.list = data.content.data;
					for (let i = 0; i < this.list.length; i++) {
						const dateStr = this.list[i].created_at;
						const datePart = dateStr.split(" ")[0]; // "2025-10-17"
						const [year, month] = datePart.split("-"); // ["2025", "10", "17"]
						this.list[i].year = year;
						this.list[i].month = month;
					}
				}
			},
			fun(item) {
				const params = encodeURIComponent(JSON.stringify(item));
				uni.navigateTo({
					url: `/pages/myactivityDeatails?data=${params}`
				});
			}
		}
	}
</script>
<style lang="less" scoped>
	.normal-login-container {
		background-color: #f4f4f4;
		/* 添加页面背景色 */
		min-height: 100vh;
		/* 确保背景色覆盖整个页面 */
	}

	.mox {
		width: 93%;
		margin-left: 12px;
		margin-top: 20px;
	}

	.tom {
		width: 100%;
		border-radius: 12px;
		background: #ffffff;
		overflow: hidden;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		margin-bottom: 20px;
		position: relative;

		.tom-fixed {
			position: absolute;
			top: 0;
			right: 30px;
			background: #339966;
			width: 60px;
			text-align: center;
			color: #ffffff;
			padding-top: 3px;
			padding-bottom: 3px;
			border-radius: 0% 0% 35% 35%;
		}

		.tom-img {
			width: 100%;
		}

		.tom-som {
			padding: 20px 12px 20px 25px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: #339966;
			font-weight: 500;
			font-size: 13px;

			.tom-som-h {
				font-weight: 600;
				font-size: 22px;
				margin-bottom: 10px;
			}

			.tom-som-span {
				font-weight: 600;
				font-size: 22px;
			}
		}
	}
</style>